home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / utilities / pu023.dms / pu023.adf / TOOLS! / Xicon.Doc.Z / Xicon.Doc
Text File  |  1988-07-08  |  17KB  |  307 lines

  1. c
  2. HH    H  H  H  H  2H  3H  4H  5H  H  H  H  5H  2H  3H  4H  15H  1H   1H  1H  1H  1H  1H  1H  0H 1H  20H    8H        8H  8H  8H  8H  8H  8H  8H  28H        0H        0H  0H  0H  0H  0H  0H  0H  40H  6H  6H  6H  6H  6H  6H  6H  42H      2H  2H  2H  2H  2H  2H  2H  2H  52H  4H  5H  6H  7H  8H  9H 59H  9H  0H 0H 9H  9H  9H  9H  9H  H  H  H  H  H  H  H  H  3H  13H  2H  1H  0H  0H  1H  2H  3H  9H8H  9H  9H  9H  9H  9H  9H  9H  18H  6H  6H  6H  6H  6H  6H  6H  6H  26H  8H  8H  8H  8H  8H  8H  8H  8H  38H  4H  4H  4H  4H  4H  4H  4H  0H  0H  0H  0H  0H  0H  0H  0H  50H  57H  7H  7H  6H  5H  4H  4H 8H 7H  7H  7H  14H       16H   16H   16H   16H   16H   14H       25H       27H   27H   27H   27H   27H   25H       11H   13H   13H   13H   13H   13H   11H   22H   24H   24H   24H   24H   24H   22H   H H H H H H H H H 1H 1H                                                                         9H 9H 9H 9H 9H 9H 9H 9H                                                                 37H                                   37H 37H 37H 37H 37H                                   71H 71H 71H 71H 41H   43H 43H 43H 43H 43H 43H 42H43H 42H 41H 40H 40H 40H 40H 40H 40H 40H 40H 38H 38H 38H  41H        48H 48H 48H 47H  46H 45H 44H 42H 41H 40H 39H 39H 39H 39H 39H 39H                        63H 63H 63H 63H 63H 63H44H                    43H 42H 41H 42H
  3. 
  4.  
  5.              XICON  --   Execute Command File from an Icon
  6.          (c) 1986, 1987 by Pete Goodeve -- All Rights Reserved
  7.    Permission is granted to distribute or modify these programs freely,
  8.    provided that no charge is made for their use, and that this notice
  9.    accompanies them.  For commercial purposes, please contact the author:
  10.                   Pete Goodeve
  11.                   3012 Deakin Street #D
  12.                   Berkeley, Calif. 94705
  13. With this program you can execute a file of AmigaDOS CLI commands
  14. directly from WorkBench, rather than using CLI, simply by double-clicking
  15. an associated icon. A full-screen window is opened to display the output.
  16. This is V2 of XICON, with many new features. You can now do such things as
  17. specify window size (or run without any window), change window title, find
  18. the directory the icon was invoked from, & specify command scripts besides
  19. the one associated with the icon. You also get a Close Gadget on the window.
  20. The text-display program TICON is now incorporated, with improvements.
  21. The straightforward use of XICON is to have a 'project' icon associated
  22. with a script file of CLI commands. When you double-click the icon, the
  23. commands in the file will be executed. A full-screen window is opened to
  24. display their output.  The window will remain open when the script is 
  25. finished until you click on the Close gadget or type a control-C (or -D).
  26. "Tool Types" can be added to the icon's info. For example, the window can
  27. close automatically by setting the ToolType 'MODE=closewindow' in the icon.
  28. If the commands have no output that you need to see, use "'MODE=nowindow'.
  29. To set size, use the Tool Type 'WINDOW=...'. To change title, use 'TITLE='.
  30. You also have the option of executing commands from the ToolTypes lines
  31. of the icon itself, if you specify them with the 'CMD=...' ToolType.
  32. You can specify additional command scripts (which will be executed before
  33. the one associated with the icon) with 'SCRIPT=...'.  You can include a 
  34. remark to be displayed in the window with 'REM=...', or a text file with
  35. 'TEXT=...'.  You can include as many of THESE Tool Types as you like; they
  36. are processed in sequence. The sequence may include a wait for a signal
  37. from the user with 'PAUSE'.
  38. The icon you click must always have a file associated with it, but this
  39. needn't NECESSARILY be a list of CLI commands; if you set 'MODE=noscript',
  40. it can be any type of data; you can operate on it if you want with commands
  41. in the ToolTypes list. If you set 'MODE=text' it will be treated as a simple
  42. text file to be displayed a page at a time in the window.
  43. The Tool Type 'LOCDIR=..' lets you specify a file in a known DIR that will
  44. be written with the complete pathname of the directory containing the icon.
  45. A 'choice' mechanism has been added to this version. You can take special
  46. action if the sequence has been aborted. See the description of the 'ABORT-'
  47. Tool Types below. You can use the 'EXISTS=' Tool Type to see if a file 
  48. exists, and abort if it does not.
  49. You can select more than one icon at a time, by holding down the SHIFT key
  50. as you click on each. Only DOUBLE-click on the LAST selection (or use the
  51. WorkBench menu "Open" item)
  52.  
  53. Text Display:
  54. When XICON is in the text display mode ('MODE=text' or 'TEXT=...') the file
  55. is displayed a window-full at a time. It will also pause if a form-feed
  56. character is encountered. To continue, type any key or click in the bottom
  57. window border. You can abort display by either clicking in the Close gadget'
  58. or typing control-C; it will immediately proceed to the next operation if 
  59. any. You will have to repeat the action to exit XICON on the last operation.
  60. This is different from the immediate exit that follows a click on the Close
  61. gadget in response to a PAUSE Tool Type.
  62.  
  63. Setup:
  64. You can install Xicon itself in any convenient directory on the same disk:
  65. Whichever directory you use, the icons that are going to invoke it must
  66. have a matching pathname as their DEFAULT TOOL (see below).
  67. You can put an icon and its associated file in any "drawer" that you can
  68. open under WorkBench. The file must have the same name as the icon (without
  69. the '.info' extension). Each icon must be of type 'PROJECT' with a DEFAULT
  70. TOOL string specifying a path to Xicon. If it is in the same directory,
  71. 'xicon' will suffice, otherwise you must use the complete pathname. A full
  72. pathname always begins with "device name", which is either an actual device
  73. (e.g. DF0:) or an assigned name (e.g. SYS:). If the icons are on the same
  74. disk as xicon, the device can be simply ":" (Example- :XICON)
  75.  
  76. Command Scripts:
  77. There are many ways to generate Command Script files with their icons.
  78. One approach is to duplicate an existing icon, then go to the CLI and
  79. modify the text file using your favorite text editor. If xicon is not in
  80. the appropriate directory, you will have to change the Default Tool in the
  81. icon to the correct pathname. Alternatively you can create the text file
  82. first, then use CLI to copy a project icon and modify it as necessary.
  83.  
  84. Modifying an icon:
  85. All the changes you NEED to make to an icon can be done with the 'Info'
  86. item in the WorkBench Menu. Select the icon you want to modify by clicking
  87. on it, press the right mouse button, & select 'Info' from the 'WorkBench'
  88. menu. This brings up an information window for that icon.
  89. To set the DEFAULT TOOL, click in that gadget and type in the string.
  90. To enter a new TOOL TYPE, click first on the ADD gadget, then click in the
  91. string gadget and type it in.  If you want to insert it into an existing
  92. set, use the arrow gadgets on the left to move to the desired point first.
  93. Use the DEL gadget to remove a line completely.
  94. When you are done, click in the SAVE box to preserve the changes. There is
  95. a bug in WorkBench1.2: Tool Types you enter into the icon may get messed
  96. up, causing the next string to be tagged on. The only fix seems to be
  97. to go back to Info, re-edit all your Tool Types, and try saving again.
  98. MODE Setting: You can alter Xicon's parameters by setting the ToolType: MODE
  99. 'MODE=closewindow' The window self-closes on completion of all commands.
  100.  
  101. 'MODE=nowindow' No window is opened, all msgs are thrown away to "NIL:"
  102.  
  103. 'MODE=noscript' prevents Xicon from trying to read commands from
  104.       its associated file. When the 'CMD=' Tool Type supplies the commands.
  105.  
  106. 'MODE=text' Displays the associated file as text, a full window at a time.
  107. Only one MODE entry will be recognized in the Tool Types array, so if you
  108. want more than one of the above options, you must specify them separated
  109. by the vertical-bar character, for example: 'MODE=noscript|closewindow'.
  110.  
  111. Modifying the Window:
  112. You can specify the size, position and title of the window that XICON opens
  113. by setting the Tool Type 'WINDOW=xxx/yyy/www/hhh/Title', where xxx and yyy
  114. are the co-ordinates of the top left corner, www and hhh are width and 
  115. height, and Title is the desired name for the window. To change the TITLE
  116. at ANY time in the sequence, use the ToolType 'TITLE=title string'. You can
  117. use this more than once in a sequence
  118.  
  119. Commands in the Icon:
  120. Instead of a script file, you can specify commands directly in the Icon Tool
  121. Types array, with the 'CMD=Command string' format; Ex: 'CMD=list df1:work'
  122. Include as many of these as you like. They will be executed in sequence,
  123. but each by a separate CLI process, so you can't use a command to set
  124. parameters like stack size or current directory for the ones that follow.
  125. A Command Script file on the other hand is executed completely by one
  126. process, so settings are inherited.
  127. If you want to execute additional command script files BEFORE the one
  128. associated with the icon (if any), use 'SCRIPT=filename'. 'filename' may
  129. be the name of a script file in the same directory as the icon, or the
  130. complete pathname of such a file. These may be interspersed with 'CMD=..'
  131. lines, etc, & are executed sequentially. Each SCRIPT= is a separate process.
  132.  
  133. Finding the Directory:
  134. An unfortunate problem of executing commands is that the new CLI has no idea
  135. of which directory it was called from. To overcome this, XICON has the Tool
  136. Type 'LOCDIR=filename'. If you include this in the icon, the specified file
  137. will be created and filled with a text string giving the complete path name
  138. of the directory containing the icon. Commands in the script can refer to
  139. this file to take appropriate action.  The string is always enclosed in
  140. quotes, and has a newline character at the end.  DOS commands such as CD
  141. or DIR can read this string simply by redirecting their input and prompting
  142. with '?' (for commands which don't need any output, you can suppress the
  143. prompt by redirecting output to NIL:). For example, include in the icon info:
  144. LOCDIR=RAM:my_icon_dir
  145. then start your script with the sequence:  CD <RAM:my_icon_dir >NIL: ?
  146. and you are now working in the right directory.  For neatness, you should
  147. also delete the file before you end the command script. Choose unique file
  148. names if you plan to be running more than one icon at a time.
  149.  
  150. Other Tool Types:
  151. You have various other actions that you can request with Tool Type strings.
  152. They may be intermixed with the previous types.
  153. 'TEXT=filename' displays the specified file in the window (like MODE=text)
  154.  
  155. 'REM=text' displays the text line as a remark at that point.
  156.  
  157. 'PAUSE'  (No "="!) pauses the sequence at that point, Continue by clicking
  158.    in the bottom border of the window or typing any key. If you click in
  159.    the Close gadget, or type control-C, all remaining Tool Type commands
  160.    will be skipped except 'RESTORE', & those with the 'ABORT-' prefix.
  161.  
  162. 'RESTORE' is only relevant if the sequence has been aborted. If encountered,
  163.    it removes the abort condition; Tool Type commands and the file
  164.    associated with the icon will be executed as normal.
  165.  
  166. 'EXISTS=filename' will set the abort condition  if the specified
  167.    file doesn't exist.
  168.  
  169. The 'abort' condition:
  170. If the Close gadget is clicked or control-C typed in response to a PAUSE,
  171. or if an 'EXISTS=...' Tool Type fails, the abort condition will be set;
  172. all further normal Tool Type commands, and execution or display of the
  173. file associated with the icon, are suppressed. If the 'RESTORE' Tool Type
  174. is encountered, normal operation is restored.
  175. There are a set of alternative Tool Type commands, corresponding to
  176. the normal ones but prefixed with 'ABORT-', that will ONLY be executed
  177. if the abort condition has been set:
  178. ABORT-REM=...
  179. ABORT-CMD=...
  180. ABORT-TEXT=...
  181. ABORT-SCRIPT=...
  182. ABORT-PAUSE
  183. Abort-Pause behaves JUST like normal PAUSE; if you click in the Continue
  184. gadget or type a key other than control-C the abort condition is REMOVED.
  185.  
  186. Sequence of Tool Types:
  187. Remember the difference between the Tool Types that control the environment
  188. ('MODE=...','WINDOW=...', etc.) and those that are scanned in sequence. The
  189. first appearance of each of the former will be recognized at startup ONLY;
  190. so they won't be affected by abort conditions. They may be placed anywhere
  191. in the set of Tool Types, in any order, and they will still be recognized.
  192.  
  193. Tool Types processed at startup are:
  194. MODE=
  195. WINDOW=
  196. LOCDIR=
  197.  
  198. Those processed in sequence are:
  199. CMD=
  200. REM=
  201. SCRIPT=
  202. TEXT=
  203. TITLE=
  204. PAUSE
  205. RESTORE
  206. EXISTS=
  207. ABORT-...
  208. If you misspell a Tool Type name, it will simply be ignored.
  209.  
  210. Caveats:
  211.    An annoying defect is that the "Execute()" system call used by xicon
  212. loses track of the current directory when invoked by a WorkBench program
  213. (it switches to DF0:). The LOCDIR Tool Type has been added to overcome this
  214. problem, but if you don't use this you will have to specify full pathnames.
  215. The "Execute" referred to above is NOT the DOS "EXECUTE" Command. Actually,
  216. this system call (and therefore xicon) requires the DOS "RUN" command be in
  217. the "C:" directory for its operation. Because xicon's method of calling
  218. Execute() sets up the command file as the input stream, the output window
  219. cannot be used as a console.  So if a command needs keyboard input it must
  220. open its own using I/O redirection, e.g.: mycommand <CON:0/100/150/50/input
  221. You might also want to try "EXECUTE CON:0/100/150/50/exec"--or whatever you
  222. have renamed that command as. (To get out of the mini-CLI you just created,
  223. use 'control-\'.)  If you really want to create a full new CLI, the best
  224. method is 'NEWCLI FROM filename'
  225. The initial stack size is always 4000 bytes.  You can change this in your
  226. command script with a STACK command.  Note that the STACK gadget in the icon
  227. Info window has no effect, except on XICON itself.
  228. You cannot interrupt a command sequence with control-C or control-D,
  229. although output can be paused with the space bar in the usual way. Don't
  230. write a command file that can get "stuck" or you'll never close the window!
  231. DOS won't let you use IF, SKIP, QUIT, etc, in these command files. Of course
  232. you can use EXECUTE on a subsidiary script file, or 'NEWCLI FROM scriptfile'.
  233. You can use the RUN command from a command script, of course, but any output
  234. from the process started by RUN is thrown away instead of being displayed.  
  235. If you find these programs useful, please pass them around freely, and;
  236. I would be pleased no end if you decided to send me $5 or $10.  I'm also
  237. glad to get comments -- positive OR negative.
  238.  
  239. OTHER SHAREWARE BY THE AUTHOR: ($25.)
  240.     Smart Input Line Interpreter "Sili(Con:)"
  241. It lets you enter your commands with full cursor editing facilities.
  242. Previous commands are kept in a VISIBLE history list; you can recall
  243. commands for re-execution/re-editing, by using the arrow keys or clicking
  244. on them. This occurs in its own window. You can enter & edit commands while
  245. previous ones are running. If you have commands you are using repetively,
  246. you can call them directly from the history window by double-clicking them.
  247. You can push the command window out of the way, or bring it back with 
  248. one keystroke. Also, you can invoke command scripts without typing EXECUTE.
  249. It is downloadable from several of the commercial services, and is also
  250. on Fish disk #50. You can also order it directly, for $25 plus $3 p&p 
  251. (Calif. residents add 6.5% sales tax) from:
  252. Winners Circle Systems
  253. 2618 Telegraph Avenue
  254. Berkeley, California 94704
  255. [Tel: (415) 845-4814]
  256.         CLICK CLOSE GADGET, OR USE CTRL-C OR CTRL-D TO EXIT  
  257.